// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: packimports(3) 

package com.yoyo.lib.utilities;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.telephony.TelephonyManager;
import android.util.DisplayMetrics;

public class MobileConfig
{

    public MobileConfig(Context context)
    {
        PackageManager packagemanager;
        ctx = context;
        init();
        packagemanager = context.getPackageManager();
        mPkgInfo = packagemanager.getPackageInfo(context.getPackageName(), 0);
_L1:
        return;
        android.content.pm.PackageManager.NameNotFoundException namenotfoundexception;
        namenotfoundexception;
        namenotfoundexception.printStackTrace();
          goto _L1
    }

    public static MobileConfig getMobileConfig(Context context)
    {
        if(mMobileConfig == null)
            mMobileConfig = new MobileConfig(context);
        return mMobileConfig;
    }

    public String getBrand()
    {
        return Build.BRAND;
    }

    public float getDensity()
    {
        float f;
        if(ctx != null)
            f = ctx.getResources().getDisplayMetrics().density;
        else
            f = 1.5F;
        return f;
    }

    public String getDevice()
    {
        return Build.DEVICE;
    }

    public String getDeviceId()
    {
        return tm.getDeviceId();
    }

    public int getHeight()
    {
        return ctx.getApplicationContext().getResources().getDisplayMetrics().heightPixels;
    }

    public String getLine1Number()
    {
        return tm.getLine1Number();
    }

    public String getMANUFACTURER()
    {
        return Build.MANUFACTURER;
    }

    public String getMobileModel()
    {
        return Build.MODEL;
    }

    public String getMobileOsVersion()
    {
        return android.os.Build.VERSION.RELEASE;
    }

    public String getModel()
    {
        return Build.MODEL;
    }

    public String getNetworkOperator()
    {
        return tm.getNetworkOperator();
    }

    public String getNetworkOperatorName()
    {
        return tm.getNetworkOperatorName();
    }

    public int getNetworkType()
    {
        return tm.getNetworkType();
    }

    public String getNetworkTypeName()
    {
        String s = "others";
        if(cm != null) goto _L2; else goto _L1
_L1:
        s = "others";
_L4:
        return s;
_L2:
        NetworkInfo networkinfo;
        networkinfo = cm.getActiveNetworkInfo();
        if(networkinfo != null)
            break; /* Loop/switch isn't completed */
        s = "others";
        if(true) goto _L4; else goto _L3
_L3:
        if(networkinfo.getType() == 0)
            switch(getNetworkType())
            {
            case 0: // '\0'
                s = "others";
                break;

            case 2: // '\002'
                s = "EDGE";
                break;

            case 1: // '\001'
                s = "GPRS";
                break;

            case 3: // '\003'
                s = "UMTS";
                break;
            }
        else
        if(networkinfo.getType() == 1)
            s = "WIFI";
        if(true) goto _L4; else goto _L5
_L5:
    }

    public String getOS()
    {
        return "android";
    }

    public String getPackageName()
    {
        return mPkgInfo.packageName;
    }

    public int getPhoneType()
    {
        return tm.getPhoneType();
    }

    public int getPkgVerCode()
    {
        return mPkgInfo.versionCode;
    }

    public String getPkgVerName()
    {
        return mPkgInfo.versionName;
    }

    public String getProduct()
    {
        return Build.PRODUCT;
    }

    public float getScale()
    {
        DisplayMetrics displaymetrics = ctx.getApplicationContext().getResources().getDisplayMetrics();
        float f;
        if((float)displaymetrics.widthPixels / 320F < (float)displaymetrics.heightPixels / 480F)
            f = (float)displaymetrics.widthPixels / 320F;
        else
            f = (float)displaymetrics.heightPixels / 480F;
        return f;
    }

    public String getSimOperatorName()
    {
        return tm.getSimOperatorName();
    }

    public String getSimSerialNumber()
    {
        return tm.getSimSerialNumber();
    }

    public String getSubscriberId()
    {
        return tm.getSubscriberId();
    }

    public String getUuid()
    {
        return android.provider.Settings.Secure.getString(ctx.getContentResolver(), "android_id");
    }

    public int getWidth()
    {
        return ctx.getApplicationContext().getResources().getDisplayMetrics().widthPixels;
    }

    public int getXByScale(int i)
    {
        DisplayMetrics displaymetrics = ctx.getApplicationContext().getResources().getDisplayMetrics();
        float f;
        if((float)displaymetrics.widthPixels / 320F < (float)displaymetrics.heightPixels / 480F)
            f = (float)displaymetrics.widthPixels / 320F;
        else
            f = (float)displaymetrics.heightPixels / 480F;
        return (int)(f * (float)i);
    }

    public int getXByScaleWidth(int i)
    {
        return (int)(((float)ctx.getApplicationContext().getResources().getDisplayMetrics().widthPixels / 320F) * (float)i);
    }

    public int getYByScale(int i)
    {
        DisplayMetrics displaymetrics = ctx.getApplicationContext().getResources().getDisplayMetrics();
        float f;
        if((float)displaymetrics.widthPixels / 320F < (float)displaymetrics.heightPixels / 480F)
            f = (float)displaymetrics.widthPixels / 320F;
        else
            f = (float)displaymetrics.heightPixels / 480F;
        return (int)(f * (float)i);
    }

    public int getYByScaleHeight(int i)
    {
        return (int)(((float)ctx.getApplicationContext().getResources().getDisplayMetrics().heightPixels / 480F) * (float)i);
    }

    void init()
    {
        tm = (TelephonyManager)ctx.getSystemService("phone");
        cm = (ConnectivityManager)ctx.getSystemService("connectivity");
    }

    private static final float HDPI = 1.5F;
    private static MobileConfig mMobileConfig;
    private ConnectivityManager cm;
    private Context ctx;
    private PackageInfo mPkgInfo;
    private TelephonyManager tm;
}
